package com.zzptc.kaoshi.adapter;


import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.zzptc.kaoshi.R;
import com.zzptc.kaoshi.bean.Info;

import java.util.List;

public class Xianshi_adapter extends RecyclerView.Adapter<Xianshi_adapter.MyViewHolder>{

    List<Info> list;

    public Xianshi_adapter(List<Info> list) {
        this.list = list;
    }

    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item , parent , false);
        MyViewHolder myViewHolder = new MyViewHolder(view);
        return myViewHolder;
    }

    @Override
    public void onBindViewHolder(MyViewHolder holder, int position) {
        Info itemData = list.get(position);
        holder.tv_id.setText(itemData.getStu_id()+"");
        holder.tv_name.setText(itemData.getStu_name());
        holder.tv_pwd.setText(itemData.getSut_pwd());
    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    class MyViewHolder extends RecyclerView.ViewHolder {
        TextView tv_id;
        TextView tv_name;
        TextView tv_pwd;
        public MyViewHolder(View itemView) {
            super(itemView);
            tv_id = (TextView) itemView.findViewById(R.id.tv_id);
            tv_name = (TextView) itemView.findViewById(R.id.tv_name);
            tv_pwd = (TextView) itemView.findViewById(R.id.tv_pwd);
        }
    }

}
